import jsonschema
check_rules={
    "type":"object",
    "properties":{
        "success":{"type":"boolean"},
        "code":{"type":"integer"},
        "message":{"type":"string","pattern":"登录成功$"},
        "data":{
            "type":"object",
            "properties":{
                "name":{"const":"lily"},#"type":"string",
                "age":{"const":20},#"type":"integer",

            },
            "required":["name","age"]
        }

    },
    "required":["success","code","message","data"]
}
recked_data={
    "success": False,
    "code": 10000,
    "message":"xxx登录成功",
    "data": {
            "age": 20,
            "name": "lily"
    }
}
result=jsonschema.validate(instance=recked_data,schema=check_rules)
print(result)